<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Caliga</title>
    <script type="text/javascript" src="../caliga.js" ></script>
    <script type="text/javascript" >
			var myGame;
			
			function CaligaDemo1(){
				
				if (typeof myGame == "undefined")
					myGame = new Clg.Game({idCanvas : "caliga", showFps:true});
				else
					myGame.delAllEntities();
					
				var w = myGame.getScreenWidth();
				var h = myGame.getScreenHeight();
				var fact = document.getElementById('fact').value;
				
				for (var i = 0;i < fact;i++){
					var newEntity = new Clg.Line({
										pos:{
											x:Math.random()*w,
											y:Math.random()*h
										},
										dots:[
										{
											x: Math.random()*w,
											y: Math.random()*h
										}]
									});
					newEntity.setDrawType("stroke");
					myGame.addEntity(newEntity);
				}
				
				myGame.Launch();	
			}
						
    </script>
    <style type="text/css">
      canvas { border: 1px solid red; }
    </style>
</head>

<body onload="CaligaDemo1();">
	<h1>Caliga JavaScript Library v0.0.6</h1>
    <h2>Demo n°1</h2>
    <p>Date : 28 Fev 2012</p>
    <a href="../index.html">Back to home</a>
    <br />
    <br />
    <form method="" action="#" onsubmit="CaligaDemo1();">
        <label for="fact">Insert a number :
        </label>
        <input id="fact" type="text" name="" value="10" />
        <input type="submit" value="Update" />
    </form>
    <br /><br />
	<canvas id="caliga" width="500" height="400">
    	Don't work !!
    </canvas>
</body>
</html>
